<template>
  <div class=""></div>
</template>
<script lang="ts" setup>
import { useRouter } from "vue-router";
import { useUserStore } from "../../store/user";
import { request } from "../../utils/request";
import { getUserInfo } from "../../api";
const router = useRouter();
const userStore = useUserStore();

function getInfo() {
  request({
    fn: getUserInfo,
    params: [],
    success(res: any) {
      const role = res.data.role;
      userStore.setUserInfo(res.data);
      if (role === "TEACHER") {
        router.push("/teacher");
      } else {
        router.push("/student");
      }
    },
  });
}
getInfo();
</script>
<style scoped lang="scss"></style>
